package com.hw.logbackDemo.controller;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class LogDemo {
	Logger log=LoggerFactory.getLogger(LogDemo.class);
	
	@RequestMapping(value="/info",method=RequestMethod.GET)
	public String info() {
		log.info("this is logback info");
		return "info";
	}
	@RequestMapping(value="/debug",method=RequestMethod.GET)
	public String debug() {
		log.debug("this is logback debug");
		return "debug";
	}
	@RequestMapping(value="/myerror",method=RequestMethod.GET)
	public String error() {
		log.error("this is logback error");
		return "error";
	}
	@RequestMapping(value="/trace",method=RequestMethod.GET)
	public String trace() {
		log.trace("this is logback trace");
		return "trace";
	}
	@RequestMapping(value="/warn",method=RequestMethod.GET)
	public String warn() {
		log.warn("this is logback warn");
		return "warn";
	}

}
